<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('Customer/index')}">用户列表</a></li>
		</ul>
        <form class="well form-search" method="post" action="{:U('Customer/index')}">
			关键字:
            <input type="text" name="keywork" style="width: 200px;" value="{:I('request.keywork/s','')}" placeholder="用户id/昵称/OpenId">
			是否刷单：
			<select name="is_bark" style="width: 100px">
				<option value="">全部</option>
				<option value="1">是</option>
				<option value="2">否</option>
			</select>
			排序：
			<select name="orderby" style="width: 200px">
				<option value="">按注册时间降序</option>
				<option value="1">按上榜字数降序</option>
				<option value="2">按余额降序</option>
				<option value="3">按登录时间降序</option>
			</select>
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:U('Customer/index')}">清空</a>
        </form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th>ID</th>
					<th>昵称</th>
					<th>头像</th>
					<th>性别</th>
					<th>余额</th>
					<th>发红包（次数/金额）</th>
					<th>领取（次数/金额）</th>
					<th>提现（次数/金额）</th>
					<th>注册IP</th>
					<th>注册时间</th>
					<th>最后登录时间</th>
					<th>上榜字数</th>
					<th>是否刷单</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="users" item="vo">
				<tr>
					<td>{$vo.id}</td>
					<td>{$vo.nick_name}</td>
					<td><a class="img-show" href="javascript:" attr-img="{$vo.head_img}"><img width="30" height="30" src="{$vo.head_img}"/></a></td>
					<td>{$vo.sex}</td>
					<td>{$vo.amount}</td>
					<td>{$vo.pay_num}次 / ￥{$vo.pay_amount}</td>
					<td>{$vo.receive_num}次 / ￥{$vo.receive_amount}</td>
					<td>{$vo.wd_num}次 / ￥{$vo.wd_amount}</td>
					<td>{$vo.ip_addr}</td>
					<td>{$vo.add_time}</td>
					<td>{$vo.update_time}</td>
					<td>{$vo.rank_num}</td>
					<td>{$vo.bark_info}</td>
					<td>
						<if condition="$vo.status == 0" >
							<button class="forbid btn btn-sm btn-default btn-danger" data-id="{$vo.id}">禁用</button>
							<else/>
							<button class="recover btn btn-sm btn-default btn-default" data-id="{$vo.id}">启用</button>
						</if>
						<if condition="$vo.is_bark == 0" >
							<button class="flag_bark btn btn-sm btn-default btn-danger" data-id="{$vo.id}">标记为刷单</button>
							<else/>
							<button class="recover_bark btn btn-sm btn-default btn-default" data-id="{$vo.id}">解除刷单</button>
						</if>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		$('.img-show').on('click',function(){
		   var img_src = $(this).attr('attr-img');
		   console.log(img_src);
            //页面层-自定义
            layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                skin: 'yourclass',
                content: '<img src="'+img_src+'"/>'
            });
		})
		/*$('.add-to-vip').on('click', function () {
		    var openid = $(this).parents('tr').find('.openid').text();
		    $.post("{:U('User/addToWealthyGroup')}", {'openid':openid}, function ($data) {
				alert($data.msg);
			});
		});
		$('.remove-from-vip').on('click', function() {
		    var openid = $(this).parents('tr').find('.openid').text();
			$.post("{:U('User/removeFromWealthyGroup')}", {'openid':openid}, function ($data) {
				alert($data.msg);
			});
		})*/
        $('.forbid').on('click', function () {
            var user_id = $(this).attr('data-id');
            $.post("{:U('Customer/forbid')}", {'user_id':user_id}, function ($data) {
                alert($data.msg);
            });
        });
        $('.recover').on('click', function () {
            var user_id = $(this).attr('data-id');
            $.post("{:U('Customer/recover')}", {'user_id':user_id}, function ($data) {
                alert($data.msg);
            });
        });
        $('.flag_bark').on('click', function () {
            var user_id = $(this).attr('data-id');
            $.post("{:U('Customer/flag_bark')}", {'user_id':user_id}, function ($data) {
                alert($data.msg);
            });
        });
        $('.recover_bark').on('click', function () {
            var user_id = $(this).attr('data-id');
            $.post("{:U('Customer/recover_bark')}", {'user_id':user_id}, function ($data) {
                alert($data.msg);
            });
        });
	</script>
</body>
</html>